package com.ylink.lkx.controller;


import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * freemarker模板使用
 * 在pom加入依赖spring-boot-starter-freemarker
 * 默认的路径在 classpath:templates 文件下，默认扩展名为.ftl
 * @author kangx
 *
 */
@Controller
@RequestMapping(value = "/web")
public class WebController {

	@RequestMapping(value = "index")
	public String index(ModelMap map) {
		map.put("title", "freemarker hello word");
		System.out.println("index...");
		return "index"; 
	}

	@RequestMapping(value="error")
	public String error(ModelMap map) {
		System.out.println("method error 测试异常");
		throw new RuntimeException("测试异常");
	}
}
